angular.module('myApp').controller('save',["$scope","$http","$state",function ($scope,$http,$state) {
    $scope.updata=function(){
        $http({
            method:'post',
            url:'/save',
            data:{
                student:{name:$scope.name,sex:$scope.sexa,age:$scope.age,sfzh:$scope.sfzh,banji_id:$scope.Class1,nianji_id:$scope.grade1,banzhuren_id:$scope.teacher1}
            }
        }).then(function (data) {
            if (data.data.state="ok")
            	$state.go('home');
        })
    };
    $http({
        method:'post',
        url:'/classInformation'
    }).then(function (data) {
        $scope.Class=data.data;
        console.log(data.data);
    });
    $http({
        method: 'post',
        url: '/gradeInformation',
    }).then(function (data) {
        $scope.grade=data.data;
    });
    $http({
        method: 'post',
        url: '/teacherInformation',
    }).then(function (data) {
        $scope.teacher=data.data;
    });
}]);